/*    */ package com.zimbra.cs.store.file;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.store.Blob;
/*    */ import com.zimbra.cs.store.BlobBuilder;
/*    */ import com.zimbra.cs.volume.Volume;
/*    */ import com.zimbra.cs.volume.VolumeManager;
/*    */ import java.io.IOException;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public final class VolumeBlobBuilder
/*    */   extends BlobBuilder
/*    */ {
/*    */   VolumeBlobBuilder(Blob targetBlob)
/*    */   {
/* 30 */     super(targetBlob);
/*    */   }
/*    */   
/*    */   private short getVolumeId() {
/* 34 */     return ((VolumeBlob)this.blob).getVolumeId();
/*    */   }
/*    */   
/*    */   protected boolean useCompression() throws IOException
/*    */   {
/* 39 */     if (this.disableCompression) {
/* 40 */       return false;
/*    */     }
/*    */     try {
/* 43 */       return VolumeManager.getInstance().getVolume(getVolumeId()).isCompressBlobs();
/*    */     } catch (ServiceException e) {
/* 45 */       throw new IOException("Unable to determine volume compression flag", e);
/*    */     }
/*    */   }
/*    */   
/*    */   protected int getCompressionThreshold()
/*    */   {
/*    */     try
/*    */     {
/* 53 */       return (int)VolumeManager.getInstance().getVolume(getVolumeId()).getCompressionThreshold();
/*    */     } catch (ServiceException e) {
/* 55 */       ZimbraLog.store.error("Unable to determine volume compression threshold", e);
/*    */     }
/* 57 */     return 0;
/*    */   }
/*    */   
/*    */   public Blob finish() throws IOException, ServiceException
/*    */   {
/* 62 */     if (isFinished()) {
/* 63 */       return this.blob;
/*    */     }
/* 65 */     super.finish();
/* 66 */     return this.blob;
/*    */   }
/*    */   
/*    */   public String toString()
/*    */   {
/* 71 */     return super.toString() + ", volume=" + getVolumeId();
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/store/file/VolumeBlobBuilder.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */